package avicit.bdp.dgs.qa.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.bdp.dgs.qa.utils.enums.JobResultType;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2023-05-29
 * @类说明：WorkOrderDTO
 * @修改记录：
 * @注意事项：
 * @主要功能：工单管理DTO
 */
@ApiModel(value = "WorkOrderDTO", description = "工单管理DTO")
@Table(name = "bdp_dgs_qa_work_order")
public class WorkOrderDTO extends BaseDTO {
    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 名称
     */
    @LogField
    @ApiModelProperty(value = "名称")
    @FieldRemark(column = "name", field = "name", name = "名称")
    @Column(name = "name")
    private String name;

    /**
     * 工单级别，0:低、1:中、2:高
     */
    @LogField
    @ApiModelProperty(value = "工单级别，0:低、1:中、2:高")
    @FieldRemark(column = "level", field = "level", name = "level")
    @Column(name = "level")
    private Integer level;
    @Transient
    private String levelName;

    /**
     * 状态，0:待指派、1:待处理、2:待验证、3:已完结
     */
    @LogField
    @ApiModelProperty(value = "状态，0:待指派、1:待处理、2:待验证、3:已完结")
    @FieldRemark(column = "state", field = "state", name = "state")
    @Column(name = "state")
    private Integer state;
    @Transient
    private String stateName;

    /**
     * 处理方式，0:指派处理人、1:忽略、2:手动处理
     */
    @LogField
    @ApiModelProperty(value = "处理方式，0:指派处理人、1:忽略、2:手动处理")
    @FieldRemark(column = "processMode", field = "processMode", name = "processMode")
    @Column(name = "process_mode")
    private Integer processMode;
    @Transient
    private String processModeName;

    /**
     * 处理意见
     */
    @LogField
    @ApiModelProperty(value = "处理意见")
    @FieldRemark(column = "suggestion", field = "suggestion", name = "suggestion")
    @Column(name = "suggestion")
    private String suggestion;

    /**
     * 指派的处理人
     */
    @LogField
    @ApiModelProperty(value = "处理人")
    @FieldRemark(column = "dealUser", field = "dealUser", name = "dealUser")
    @Column(name = "deal_user")
    private String dealUser;
    @Transient
    private String dealUserName;

    /**
     * 质量作业ID
     */
    @LogField
    @ApiModelProperty(value = "质量作业ID")
    @FieldRemark(column = "jobId", field = "jobId", name = "jobId")
    @Column(name = "job_id")
    private String jobId;

    /**
     * 流程实例ID
     */
    @LogField
    @ApiModelProperty(value = "流程实例ID")
    @FieldRemark(column = "processInstanceId", field = "processInstanceId", name = "processInstanceId")
    @Column(name = "process_instance_id")
    private String processInstanceId;

    /**
     * 校验结果
     */
    @Transient
    private JobResultType jobResultType;

    /**
     * 是否为验证任务；true：是，false：否；
     * 注意：不用定义is开头遍历，否则IDEA自动生成set/get方法跟变量名对不上，后台接收前端参数有问题
     */
    @Transient
    private Boolean verifyTask;

    /**
     * 工单关联的任务状态；0:草稿、1:运行中、5:停止、6:失败、7:成功
     */
    @Transient
    private Integer jobState;

    /**
     * 当前处理人
     */
    @Transient
    private String currDealUser;
    @Transient
    private String currDealUserName;

    /**
     * 工单界面上是否展示处理选项，true：展示、false：不展示
     * @return
     */
    @Transient
    private Boolean display;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getStateName() {
        return stateName;
    }

    public void setStateName(String stateName) {
        this.stateName = stateName;
    }

    public String getDealUser() {
        return dealUser;
    }

    public void setDealUser(String dealUser) {
        this.dealUser = dealUser;
    }

    public String getDealUserName() {
        return dealUserName;
    }

    public void setDealUserName(String dealUserName) {
        this.dealUserName = dealUserName;
    }

    public Integer getProcessMode() {
        return processMode;
    }

    public void setProcessMode(Integer processMode) {
        this.processMode = processMode;
    }

    public String getProcessModeName() {
        return processModeName;
    }

    public void setProcessModeName(String processModeName) {
        this.processModeName = processModeName;
    }

    public String getSuggestion() {
        return suggestion;
    }

    public void setSuggestion(String suggestion) {
        this.suggestion = suggestion;
    }

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }

    public JobResultType getJobResultType() {
        return jobResultType;
    }

    public void setJobResultType(JobResultType jobResultType) {
        this.jobResultType = jobResultType;
    }

    public Boolean getVerifyTask() {
        return verifyTask;
    }

    public void setVerifyTask(Boolean verifyTask) {
        this.verifyTask = verifyTask;
    }

    public Integer getJobState() {
        return jobState;
    }

    public void setJobState(Integer jobState) {
        this.jobState = jobState;
    }

    public String getCurrDealUser() {
        return currDealUser;
    }

    public void setCurrDealUser(String currDealUser) {
        this.currDealUser = currDealUser;
    }

    public String getCurrDealUserName() {
        return currDealUserName;
    }

    public void setCurrDealUserName(String currDealUserName) {
        this.currDealUserName = currDealUserName;
    }

    public Boolean getDisplay() {
        return display;
    }

    public void setDisplay(Boolean display) {
        this.display = display;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "工单管理模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "工单管理";
        } else {
            return super.logTitle;
        }
    }
}
